package com.zsf.serviceImp;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.zsf.dao.ProductDao;
import com.zsf.pojo.Product;
import com.zsf.service.ProductService;
import com.zsf.util.MyBatiseUtil;

public class ProductServiceImp implements ProductService {

	public List getProductAll() {
		SqlSession session=MyBatiseUtil.getSession();
		List list =session.getMapper(ProductDao.class).select();
		MyBatiseUtil.close(session);
		return list;
	}

	public Product getProductById(Product product) {
		return null;
	}

	public Product getProductByCode(Product product) {
		return null;
	}

	public void insertProduct(Product product) {
		SqlSession session=MyBatiseUtil.getSession();
		session.getMapper(ProductDao.class).insert(product);
		MyBatiseUtil.close(session);
	}

	public void updateProduct(Product product) {
		
	}

	public List getProductByTitle(String title) {
		SqlSession session=MyBatiseUtil.getSession();
		List list=session.getMapper(ProductDao.class).selectByTitle(title);
		MyBatiseUtil.close(session);
		return list;
	}

	public List<Product> getProductByTitle_Tag_Id(Product product) {
		
		SqlSession session=MyBatiseUtil.getSession();
		List list =session.getMapper(ProductDao.class).selectByTitle_Tag_Id(product);
		MyBatiseUtil.close(session);
		return	list;
	}

}
